package com.ruoyi.web.controller.biz;

import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.BizInformation;
import com.ruoyi.system.domain.BizProductSeries;
import com.ruoyi.system.domain.vo.BizProductSeriesRequest;
import com.ruoyi.system.domain.vo.BizProductSeriesResponse;
import com.ruoyi.system.service.BizInformationService;
import com.ruoyi.system.service.BizProductSeriesService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/biz/productSeries")
public class ProductSeriesController extends BaseController {

    @Resource
    private BizProductSeriesService productSeriesService;

    @Anonymous
    @GetMapping("/list")
    public TableDataInfo list(BizProductSeriesRequest bizProductSeriesRequest) {
        startPage();
        List<BizProductSeriesResponse> productSeriesList = productSeriesService.selectProductSeriesList(bizProductSeriesRequest);
        return getDataTable(productSeriesList);
    }

    @Anonymous
    @GetMapping(value = "/queryById")
    public AjaxResult queryById(@RequestParam("id") Long id) {
        return success(productSeriesService.selectProductSeriesById(id));
    }

    @Anonymous
    @PostMapping("/save")
    public AjaxResult save(@RequestBody BizProductSeries bizProductSeries) {
        return toAjax(productSeriesService.insertProductSeries(bizProductSeries));
    }

    @Anonymous
    @PutMapping("/update")
    public AjaxResult update(@RequestBody BizProductSeries bizProductSeries) {
        return toAjax(productSeriesService.updateProductSeries(bizProductSeries));
    }

    @Anonymous
    @DeleteMapping("/delete/{id}")
    public AjaxResult delete(@PathVariable("id") Long id) {
        return toAjax(productSeriesService.deleteProductSeriesById(id));
    }

    @Anonymous
    @GetMapping("/queryByCondition")
    public TableDataInfo queryByCondition(BizProductSeriesRequest bizProductSeriesRequest) {
        startPage();
        List<BizProductSeriesResponse> productSeriesList = productSeriesService.selectProductSeriesList(bizProductSeriesRequest);
        return getDataTable(productSeriesList);
    }

    @Anonymous
    @GetMapping("/allList")
    public List<BizProductSeriesResponse> queryAllList(BizProductSeriesRequest bizProductSeriesRequest) {
        return productSeriesService.selectProductSeriesList(bizProductSeriesRequest);
    }


}
